package ru.spb.nicetu.schoolproject;

import ru.spb.nicetu.schoolproject.data.HibernateTblModel;
import ru.spb.nicetu.schoolproject.data.Mark;

/**
 * Created by dchernyshov on 16.04.15.
 */
public class TblModelForMark extends HibernateTblModel <Mark> {

    public TblModelForMark() {
        super(Mark.class, 2);
    }

    @Override
    public String getColumnName(int columnIndex) {
        switch (columnIndex) {
            case 0:
                return "Ученик";
            case 1:
                return "Предмет";
            case 2:
                return "Учитель";
            case 3:
                return "Оценка";
            default: return "";
        }
    }

    @Override
    public int getColumnCount() {
        return 4;
    }

    @Override
    public Object getValueAt(int i, int i1) {
        Mark mark= list.get(i);
        switch (i1) {
            case 0:
                return mark.getPupil().getPupilName().trim();
            case 1:
                return mark.getSubject().getName().trim();
            case 2:
                return mark.getTeacher().getTeacherName().trim();
            case 3:
                return mark.getMarkValue();
        }
        return null;
    }
}
